﻿@model Mondial2014.Controllers.FixturesController.FixturesViewMoldel

@{
    ViewBag.Title = "שלב הבתים";
}

<h2>משחקים בשלב הבתים</h2>
<br/>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => Model.Fixtures.First().Number)
        </th>
        <th>
            @Html.DisplayNameFor(model => Model.Fixtures.First().Date)
        </th>
        <th>
            @Html.DisplayNameFor(model => Model.Fixtures.First().Group)
        </th>
        <th>
            @Html.DisplayNameFor(model => Model.Fixtures.First().Team1)
        </th>
        <th>
            @Html.DisplayNameFor(model => Model.Fixtures.First().Team2)
        </th>
        <th>
            @Html.DisplayNameFor(model => Model.Fixtures.First().GetScore)
        </th>
        <th></th>
</tr>

    @foreach (var item in Model.Fixtures.OrderBy(f => f.Date))
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Number)
            </td>
            <td>
                @item.Date.ToString("d.M - HH:mm")
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Group.Number)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Team1.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Team2.Name)
            </td>
            <td>
                @if (item.Played)
                {
                    @Html.DisplayFor(modelItem => item.GetScore)
                }
            </td>
            <td>
                @if (Model.Admin && item.Date <= DateTime.Now.AddHours(3))
                {
                    @Html.ActionLink("עדכן תוצאה", "Edit", new { id = item.Id })
                }
            </td>
        </tr>
    }

</table>